package com.kingwood.algorithm.test;

import java.util.Scanner;

/**
 * @Author 22025812
 * @Description: 停车场车辆统计
 * https://fcqian.blog.csdn.net/article/details/127205555
 * @Date: 2024/3/28 9:33
 * @Modified By：
 * @Version 1.0
 */
public class CarsCount {
    public static int countCars(String str) {
        int count = 0;
        if (str.length() == 0) {
            return count;
        }

        str = str.replaceAll(",", "")
                .replaceAll("111", "X")
                .replaceAll("11", "X")
                .replaceAll("1", "X");

        System.out.println(str);
        int len = str.length();
        for (int i = 0; i < len; i++) {
            if (str.charAt(i) == 'X') {
                count++;
            }
        }

        return count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        System.out.println(countCars(str));
    }
}
